/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.bot.utils;

import java.util.LinkedHashMap;

/**
 *
 * @author chipn03877
 */
public class URLUtils {

    public static LinkedHashMap<String, String> getQueryMap(String query) {
        LinkedHashMap<String, String> params = new LinkedHashMap<String, String>();
        if (query == null || query.trim().isEmpty()) {
            return params;
        }
        String[] paramQueries = query.split("&");
        for (String paramQuery : paramQueries) {
            String[] paramQueryPair = paramQuery.split("=");
            if (paramQueryPair.length != 2) {
                continue;
            }
            params.put(paramQueryPair[0], paramQueryPair[1]);
        }
        return params;
    }
}
